{extend name="public:common_edit"/}
{block name="css"}
    <link href="/public/plugs/switch-button/css/bootstrap-switch.css" rel="stylesheet">
{/block}
{block name="main"}
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-list"></i>{$title}</h3>
        </div>
        <div class="panel-body">
            <div class="navbar navbar-default">
                <form action="" id="search-form2" class="navbar-form form-inline" method="get" onsubmit="return false">
                    <label class="control-label" for="input-order-id">房间名</label>
                    <div class="input-group">
                        <input type="text" name="room_name" value="{$Think.get.room_name}" placeholder="房间名房间id筛选"
                               id="input-order-id" class="form-control">
                    </div>
                    <div class="input-group">
                        <input type="text" name="nick_name" value="{$Think.get.nick_name}" placeholder="用户昵称id筛选"
                               class="form-control">
                    </div>
                    <label class="control-label" for="input-order-id">类型</label>
                    <select class="form-control" name="type">
                        <option id="type2" value="">全部</option>
                        <option id="type1" value="1">正常派单</option>
                        <option id="type0" value="0">弃单</option>
                    </select>


                    <label class="control-label" for="input-order-id">状态</label>
                    <select class="form-control" name="status">
                        <option id="status2" value="">全部</option>
                        <option id="status1" value="1">派单结束</option>
                        <option id="status0" value="0">进行中</option>
                    </select>

                    <button type="submit" onclick="javascript:document.getElementById('search-form2').submit();"
                            id="button-filter search-order" class="btn btn-primary"><i class="fa fa-search"></i> 筛选
                    </button>
                </form>
            </div>
            <div id="ajax_return">
                <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <td>id</td>
                                <td>房间名</td>
                                <td>派单用户</td>
                                <td>派单耗时(秒)</td>
                                <td>备注</td>
                                <td>类型</td>
                                <td>状态</td>
                                <td>操作</td>
                            </tr>
                            </thead>
                            <tbody>
                            <!-- 列表循环开始 -->
                            {volist name="rows" id="row"}
                            <tr>
                                <td>{$row.id}</td>
                                <td>{$row.room_name}</td>
                                <td>{$row.nick_name}</td>
                                <td>{$row.use_time}</td>
                                <td>{$row.remark}</td>
                                <td>{$row.type_text}</td>
                                <td>{$row.status_text}</td>

                                <td>
                                    <span class="btn btn-danger check_del" data-url=" {:url('del',['id'=>$row['id']])}">删除</span>

                                </td>
                            </tr>
                            {/volist}
                            <!-- 列表循环结束 -->
                            </tbody>
                        </table>
                    </div>
                </form>
            </div>
            <div id='pagerarea'>{$pageHTML}</div>
        </div>

    </div>
{/block}

{block name="js"}
<script src="/public/plugs/switch-button/js/bootstrap-switch.js"></script>
<script>
    $(document).ready(function(){
        $(".checkbox").bootstrapSwitch({
            onText:'是',
            offText:'否'
        });
        $('.is_top').on('switchChange.bootstrapSwitch', function (event,state){
            var val = state?1:0;
            var id = $(this).attr('data-id');
            $.post("{:url('top')}",{id:id,val:val},function (data) {
                if(data.code!=1){layer.msg('改变状态失败', {icon: 5, time: 2000});}
            });
        });
    });
    $(function () {
        var top   = "{:input('get.top')}";
        if(top != ''){
            $('#top'+top).attr('selected',true)
        }

        var status   = "{:input('get.status')}";
        if(status != ''){
            $('#status'+status).attr('selected',true)
        }
        var type   = "{:input('get.type')}";
        if(type != ''){
            $('#type'+type).attr('selected',true)
        }
    })
</script>



{/block}



